// page/indent/indent.js
// 获取应用实例
const app = getApp()
const api = require('../../config.js');
const http = require('../../http/http.js')
Page({




  /**
   * 页面的初始数据
   */
  data: {
    currentTab: 0,
    shangx: "0",
    getLocation: [],
    callme: [],
    fenlei: [],
    jiushui: [],
    meishi: null,
    indicatorDots: true,
    autoplay: false,
    interval: 5000,
    duration: 1000,
    // 头部组件
    nvabarData: {
      showCapsule: 0, //是否显示左上角图标   1表示显示    0表示不显示
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  clickTab: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current,
      })
    }
  },
  Tab: function (e) {
    var that = this;
    console.log(e.target.dataset.current)
    if (this.data.shangx === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        shangx: e.target.dataset.current,
      })
    }
  },
  getLocation: function () {
    wx.getLocation({
      type: 'wgs84',
      success: function (res) {
        wx.openLocation({ //​使用微信内置地图查看位置。
          latitude: 29.6463000000, //要去的纬度-地址
          longitude: 91.1469500000, //要去的经度-地址
          name: "西藏拉萨市城关区吉日街道办事处江苏路36号",
          address: '西藏拉萨市城关区吉日街道办事处江苏路36号'
        })
      }
    })
  },
  // 打电话
  callme: function () {
    wx.makePhoneCall({
      phoneNumber: "17535815094",
    })
  },

  onShow: function () {

  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {




  },
  onLoad: function (options) {
    var that = this;
    http( //首页
      "https://web-gateway.newbeescm.com/ms-web/shopGoodsCategory/homeCategoryList",
      "params", {
        shopId: 18,
        storeId: 56200
      },
      "POST"
    ).then(res => {
      console.log("enenenenene", res);
      that.setData({
        fenlei: res.data.result,
      })
    }),
      http(
        api.ing1,
        "data", {
          "status": "1",
          "shopId": 18,
          "storeId": 1558,
          "salesCategoryId": 1680037,
          "sortType": 5,
          "isAsc": false,
          "teminal": 2,
          "customerId": 589,
          "currentPage": 0,
          "pageSize": 15
        },
        "post",
      ).then(res => {
        that.setData({
          jiushui: res.data.result.items,
        })
        console.log(res);
        console.log(that.data.jiushui)
      }),


      http(
        api.ing1,
        "data",
        {
          "status": "1",
          "shopId": 18,
          "storeId": 1558,
          "salesCategoryId": 1700002,
          "sortType": 5,
          "isAsc": false,
          "teminal": 2,
          "customerId": 589,
          "currentPage": 0,
          "pageSize": 15
        },
        "post"
      ).then(res => {
        this.setData({
          meishi: res.data.result.items
        })
        console.log("ddd", res.data.result.items);
        console.log("kkk", this.data.meishi);
      })

  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {




  },




  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {




  },




  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {




  }
})